#include <stdio.h>
#include <stdlib.h>

void cleanup_function(){
    printf("Cleanup function called.\n");
}

int main(){
    atexit(cleanup_function);
    
    puts("Before calling exit.");
    exit(0); // This will call the registered 'cleanup_function'
}